package com.rill.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.rill.po.BlogInfo;

public class BlogInfoDaoImpl extends HibernateDaoSupport implements BlogInfoDao {

	@Override
	public void save(BlogInfo info) {
		 this.getHibernateTemplate().saveOrUpdate(info);//保存或者更新

	}

	@Override
	public BlogInfo get(String username) {
		//返回的是list
		List list = this.getHibernateTemplate().find("select bloginfo from BlogInfo bloginfo where bloginfo.username=?",username);
		
		if(list.size()==0){
			return null;//未查到
		}else{
			return (BlogInfo) list.get(0);//查找到
		}
		
	}

}
